package br.com.dinarth.model.entities;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.ForeignKey;

/**
 *
 * @author Dinarth
 */

@Entity
@Table(name="tipoLogradouro")
public class TipoLogradouro implements Serializable{
    
    private static long serialVersionUID = 1L;
    
    @Id
    @GeneratedValue
    @Column(name="IdTipoLogradouro", nullable=false)
    private Integer IdTipoLogradouro;
    @Column(name="DescricaoLogradouro", nullable = false, length=40)
    private String descricaoLogradouro;

    @OneToMany(mappedBy = "tipoLogradouro", fetch = FetchType.LAZY)
    @ForeignKey(name="TipoLogradouroEndereco")
    private List<Endereco> enderecos;
    
    
    public TipoLogradouro() {
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public static void setSerialVersionUID(long serialVersionUID) {
        TipoLogradouro.serialVersionUID = serialVersionUID;
    }

    public Integer getIdTipoLogradouro() {
        return IdTipoLogradouro;
    }

    public void setIdTipoLogradouro(Integer IdTipoLogradouro) {
        this.IdTipoLogradouro = IdTipoLogradouro;
    }

    public String getDescricaoLogradouro() {
        return descricaoLogradouro;
    }

    public void setDescricaoLogradouro(String descricaoLogradouro) {
        this.descricaoLogradouro = descricaoLogradouro;
    }

    public List<Endereco> getEnderecos() {
        return enderecos;
    }

    public void setEnderecos(List<Endereco> enderecos) {
        this.enderecos = enderecos;
    }

    
    @Override
    public int hashCode() {
        int hash = 7;
        hash = 19 * hash + Objects.hashCode(this.IdTipoLogradouro);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final TipoLogradouro other = (TipoLogradouro) obj;
        if (!Objects.equals(this.IdTipoLogradouro, other.IdTipoLogradouro)) {
            return false;
        }
        return true;
    }
    
    
    
}
